package com.karrim.server.io.sql;

import com.google.inject.Inject;
import com.karrim.server.io.sql.util.Table;
import java.sql.SQLException;

/**
 *
 * @author andrea.cantafio
 */
public class AccessLoader extends AbstractSQLLoader<AccessConnector> {

    @Inject
    public AccessLoader(AccessConnector connector) {
        super(connector);
    }

    @Override
    public Table getTableDefinition(String table) throws SQLException {
        return super.getTableDefinition(load("SELECT TOP 1 * FROM " + table).getMetaData());
    }

    @Override
    public String[] getTableNames() throws SQLException {
        return super.getTableNames("SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE ((MSysObjects.Type) In (1,4,6) AND (MSysObjects.Name NOT LIKE 'MSys%') AND (MSysObjects.Name NOT LIKE '~%')) order by MSysObjects.Name");
    }
}
